from django import forms
from django.forms import Form
from django.forms import fields
from django.forms import widgets
from django.contrib.auth import get_user_model

# User = get_user_model()
# class UserRegForm(forms.ModelForm):
#     """
#     表单类，注册用的
#     """
#     class Meta:
#         model = User
#         fields = ("username", "password", "email")
#
#         widgets = {
#
#             "password":forms.PasswordInput()
#
#         }


# class User_logforms(forms.Form):
#     username = forms.CharField(max_length=20, min_length=2, required=True, widget=widgets.TextInput(attrs={'class': 'name_input',}))
#     password = forms.CharField(max_length=20,min_length=8, required=True, widget=widgets.PasswordInput(attrs={'class': 'pass_input'}))

# class User_regforms(forms.Form):
#     username = forms.CharField(max_length=20, min_length=2, required=True,
#                                widget=widgets.TextInput(attrs={'id': 'user_name'}))
#     password = forms.CharField(max_length=20, min_length=8, required=True,
#                                widget=widgets.PasswordInput(attrs={'id':'pwd'}))
#     email = forms.EmailField(required=True,widget=widgets.TextInput(attrs={'id': 'user_name'}))

User = get_user_model()
class User_logforms(forms.ModelForm):
    username = forms.CharField(max_length=20, min_length=2, required=True,
                        widget=widgets.TextInput(attrs={'class': 'name_input',}))
    class Meta:
        model = User
        fields = ("password",)
        widgets = {
                    "password":forms.PasswordInput(attrs={'class': 'pass_input'})
                }

# User = get_user_model()
class User_regforms(forms.ModelForm):
    class Meta:
        model = User
        fields = ("username", "password", "email")
        widgets = {
            "username": forms.TextInput(attrs={'id': 'user_name'}),
            "password": forms.PasswordInput(attrs={'id':'pwd'}),
            "email": forms.TextInput(attrs = {'id': 'user_name'})
        }

class User_otherforms(forms.ModelForm):
    class Meta:
        model = User
        fields = ("phone", "address")
        widgets = {
            "phone": forms.TextInput(),
            "address": forms.TextInput()
        }